//引入封装好的接口
import {getRoleList} from '@/util/axios'
const state={
    roleList:[]
}
const getters={
    getRoleList(state){
        return state.roleList
    }
}
const mutations={
    //封装修改 state 的 mutation
    REQ_ROLETLIST(state,paylaod){
        state.roleList=paylaod
    }
}
const actions={
    //封装一修改角色列表的行动
    getRoleListAction({commit}){
        //调用接口
        getRoleList().then(res=>{
            if(res.data.code==200){
                commit('REQ_ROLETLIST',res.data.list)
            }
        })
    }
}
export default{
    state,
    getters,
    mutations,
    actions,
    namespaced: true
}
